import requests
from bs4 import BeautifulSoup



header = {
	'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'}


def BStext(url):  # 分离页面解析
	res = requests.get(url, headers=header)
	html = res.text
	soup = BeautifulSoup(html, 'html.parser')
	textpage = soup.find('div', class_='ql-editor')
	return textpage


def SatausCode(url):  # 获取文档状态
	textpage = BStext(url)  # 调用页面解析
	status = textpage.find('p').text
	statuscode = status.replace('【状态】', '')
	if statuscode == '更新':
		#print("1")
		return 1
	elif statuscode=='仅公告':
		#print("0")
		return 2
	elif statuscode=='关':
		return 0


def TEXT(url):
	textpage = BStext(url)
	p = textpage.find_all('p')
	for t in p:
		text = t.text
	text = text.replace('【内容】', '')
	print(text)